import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/front/home/HomeView.vue'
import UserLogin from '@/views/front/UserLogin.vue'
import LayoutView from '@/views/front/layout/LayoutView.vue'
import ShoppingView from '@/views/front/shop/ShoppingView.vue'
import DashboardView from '@/views/admin/DashboardView.vue'
import CategoryAdmin from '@/views/admin/ProductAdmin/CategoryAdmin.vue'
import CarouselAdmin from '@/views/admin/CarouselAdmin.vue'
import ProductAdmin from '@/views/admin/ProductAdmin/ProductAdmin.vue'
import CommentAdmin from '@/views/admin/ProductAdmin/CommentAdmin.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/layout',
    name: 'layout',
    component: LayoutView,
    children:[
      {
        path: 'home',
        name: 'home',
        component: HomeView
      },
      {
        path: 'shop',
        name: 'shop',
        component: ShoppingView
      }
    ]
  },
  
  {
    path: '/admin',
    name: 'admin',
    component: DashboardView,
    children:[
      {
        path: 'category',
        name: 'categoeyAdmin',
        component: CategoryAdmin
      },
      {
        path: 'carousel',
        name: 'carouselAdmin',
        component: CarouselAdmin
      },
      {
        path: 'product',
        name: 'productAdmin',
        component: ProductAdmin
      },
      {
        path: 'comment',
        name: 'commentAdmin',
        component: CommentAdmin
      }
    ]
  },

  {
    path:'/login',
    component:UserLogin
  },
  {
    path:'/',
    redirect:'/layout/home'
  }
]

const router = new VueRouter({
  routes
})

export default router
